//---------------------------------------------------------------------------
#ifndef uLetAutoH
#define uLetAutoH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "CForm.h"
#include "CEdit.h"
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include "CCheckB.h"
#include "CRadBtn.h"
#include "CBitBtn.h"
//---------------------------------------------------------------------------
enum TRAITEMENT_LETTRAGE { TL_LETTRER, TL_ABORT, TL_WAIT };
enum TYPE_LETTRAGE
{
  LETTRAGE_PIECE_INTERNE,
  LETTRAGE_PIECE_EXTERNE,
  LETTRAGE_COMPTES_SOLDES,
  LETTRAGE_COMBINATOIRE,
};
//---------------------------------------------------------------------------
class TfrmLettrageAuto : public CForm
{
__published:	// Composants gérés par l'EDI
    TGroupBox *GroupBox1;
    CEdit *edRecurs;
    TUpDown *udRecurs;
    TLabel *Label1;
    TPanel *CPanel1;
    TPanel *Panel1;
    TProgressBar *pbComptes;
    TLabel *lblCompte;
    TProgressBar *pbDebits;
    TProgressBar *pbCredits;
    TLabel *Label2;
    TLabel *Label3;
    TLabel *Label4;
    TLabel *lblLetFind;
    TLabel *lblLettrage;
  CRadioButton *rbPieceInterne;
  CRadioButton *rbPieceExterne;
  CRadioButton *rbSoldes;
  CRadioButton *rbCombinatoire;
  CBitBtn *btnAnnuler;
  CBitBtn *btnLettrer;
    void __fastcall btnLettrerClick(TObject *Sender);
    void __fastcall btnAnnulerClick(TObject *Sender);
  void __fastcall rbCombinatoireCheck(TObject *Sender, bool bIsChecked);
  void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
private:	// Déclarations de l'utilisateur
    TRAITEMENT_LETTRAGE m_eTraitement;
    int                 m_nLettrage;
    void __fastcall SetCompte( const AnsiString &strCompte);
    void __fastcall SetInfoCompte(const AnsiString &strInfo)
      {
        lblCompte->Caption = strInfo.IsEmpty() ? EmptyStr : ("Compte n° " + strInfo);
      }
    int  __fastcall GetRecursion() const;
public:		// Déclarations de l'utilisateur
    __fastcall TfrmLettrageAuto( TComponent* Owner, TYPE_LETTRAGE tLettrage, int Recurs);

    void __fastcall Inc()
      {
        pbComptes->Position++;
      }
    void __fastcall InitDebitCredit(int Debit,int Credit)
      {
        pbDebits->Max = Debit;
        pbCredits->Max = Credit;
        Refresh();
      }
    void __fastcall IncDebit ()
      {
        pbDebits->Position++;
        Refresh();
      }
    void __fastcall IncCredit()
      {
        pbCredits->Position++;
        Refresh();
      }
    void __fastcall DebutLettrage();
    void __fastcall FinLettrage();

    __property TRAITEMENT_LETTRAGE Traitement = { read=m_eTraitement                  };
    __property AnsiString          Compte     = {                     write=SetCompte };
    __property AnsiString InfoCompte = {write = SetInfoCompte};
    __property int                 Recursion  = { read=GetRecursion                   };
};
//---------------------------------------------------------------------------
#endif
